#ifndef __POPUP_H__
#define __POPUP_H__

#include "game_manager.h"
#include "game_map.h"

class GameManager;
class MenuPopup : public BasePage
{
    MenuPopup(GameManager *game_manager, Lcd *lcd) : gameManager(game_manager), lcd(lcd), bg("./res/memu_popup.bmp") {}

public:
    // 重写基类方法
    bool handleTouch(const Point &touch_point) override;
    void show() override;
    void hide() override;

    void continueGame();   // 继续游戏
    void restartGame();    // 重新开始
    void reBackMainPage(); // 返回主菜单

    // 创建和删除实例
    static MenuPopup *instance(GameManager *gameManager, Lcd *lcd);
    static void delInstance();

private:
    static MenuPopup *m_instance; // 单例模式
    GameManager *gameManager;
    Lcd *lcd;
    BMP bg;
};

class LevelPopup : public BasePage
{
    LevelPopup(GameManager *game_manager, Lcd *lcd) : gameManager(game_manager), lcd(lcd), bg("./res/level_popup.bmp"), back("./res/back.bmp") {}

public:
    // 重写基类方法
    bool handleTouch(const Point &touch_point) override;
    void show() override;
    void hide() override;

    void startGame(int level); // 开始游戏
    void backPrevPage();       // 返回上一页

    // 创建和删除实例
    static LevelPopup *instance(GameManager *gameManager, Lcd *lcd);
    static void delInstance();

private:
    static LevelPopup *m_instance; // 单例模式
    GameManager *gameManager;
    Lcd *lcd;
    BMP bg;
    BMP back;
};

#endif